package com.zzh.Factory;

import java.awt.*;

/**
 * @author 张占恒.
 * @date 2020/8/27.
 * @time 10:57.
 */
public class FactoryDemo {
    //使用 getShape 方法获取形状类型的对象
    public Shap getShap(String shapeType){
        if(shapeType == null){
            return null;
        }
        if(shapeType.equalsIgnoreCase("A")){
            return new A();
        } else if(shapeType.equalsIgnoreCase("B")){
            return new B();
        } else if(shapeType.equalsIgnoreCase("C")){
            return new C();
        }
        return null;
    }
}
